package com.wsh.dto.${package};

import com.wsh.dto.BaseDto;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import org.hibernate.validator.constraints.Length;

<#if isDate>
import com.fasterxml.jackson.annotation.JsonFormat;
</#if>
import java.util.Date;
import java.io.Serializable;

/**
* @author ${author}
* @date ${date}
*/
@Data
public class ${className}Dto extends BaseDto implements Serializable {

    private static final long serialVersionUID = 1L;

<#if forms??>
    <#list forms as column>
    /** ${column.label} */
    <#if column.dateRule??>
    @JsonFormat(pattern = "${column.dateRule}")
    </#if>
    <#if column.notBlank>
        <#if column.colType = "String">
    @NotBlank(message = "${column.label}不能为空")
        <#else>
    @NotNull(message = "${column.label}不能为空")
        </#if>
    </#if>
    <#if column.minLength?? || column.maxLength??>
    @Length(<#if column.maxLength??>max = ${column.maxLength},</#if><#if column.minLength??> min = ${column.minLength}</#if>, message = "${column.label}长度不正确")
    </#if>
    <#if column.regxpRule??>
    @Pattern(regexp = "${column.regxpRule}", message = "${column.label}格式不正确")
    </#if>
    private ${column.colType} ${column.colName};

    </#list>
</#if>
}
